package bookstudytest.Compare.Comparator;

import com.sun.xml.internal.ws.api.ha.StickyFeature;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @Author li.heng
 * @Date 2019/6/19 16
 * @Description:
 **/
public class Test {
    public static void main(String[] args) {
        Student[] student = new Student[7];
        student[0] = new Student("le", "jian xue Street", "net security");
        student[1] = new Student("tu", "jian xue Street", "net security");
        student[2] = new Student("hou", "jian xue Street", "net security");
        student[3] = new Student("jin", "jian xue Street", "net security");
        student[4]= new Student("wu", "jian xue Street", "net security");
        student[5] = new Student("wang", "jian xue Street", "net security");
        student[6] = new Student("ang", "jian xue Street", "net security");
        ArrayList<Student> students = new ArrayList<>(10);

        students.sort(Comparator.comparing(Student::getName));


        students.addAll(Arrays.asList(student));
        students.stream().sorted(Comparator.comparing(Student::getName)).forEach(System.out::println);
        System.out.println("................");
        students.forEach(System.out::println);
    }
}
